/**
 * Created by zhangwenlei on 2017/4/27.
 */
var express = require('express');
var path = require('path');
var router = express.Router();
var spawn = require('child_process').spawn;
var http = require('http');

router.post('/', function(req, res) {
    
        var options = {
            port: 3005,
            path: '/compile',
            method: 'post',
            headers: {
                'Content-Type': 'application/json'
            }
        };
        var reqData = {
            compilerid:'bcp',
            jsonPath: path.join(__dirname, '..', '..', 'mvc-new', 'bundles', 'bundle', 'model', 'test.json'),
            bundleFolderPath:path.join(__dirname, '..', '..', 'mvc-new', 'bundles', 'bundle'),
            outputFolder:'target'
        };
        var serverRequest = http.request(options, function(response) {
            response.pipe(res);
        });
        serverRequest.write(JSON.stringify(reqData));
        serverRequest.end();
});

module.exports = router;